package com.jiazhong.example.project.bookstore.front.controller;

import com.jiazhong.example.project.bookstore.commons.util.JsonResult;
import com.jiazhong.example.project.bookstore.front.service.SeckillService;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/seckill")
public class SeckillController {
    @Resource
    private SeckillService seckillService;

    @GetMapping("/load")
    public JsonResult loadSeckill() {
        return seckillService.loadSeckill();
    }

    @PostMapping
    public JsonResult seckill(String seckillId, HttpServletRequest request) {
        return seckillService.seckill(seckillId, request);
    }
}
